<script>
import { getToken } from "@/utils/token.js";
import { getLoginStatus } from "@/api";
export default {
  onLaunch: function () {
    console.log("App Launch");
    // #ifdef H5
    getLoginStatus().then((val) => {
      console.log("用户登录状态", val);
      if (val.data.profile != null && getToken()) {
        uni.switchTab({
          url: "/pages/home/index",
        });
      } else {
        uni.redirectTo({
          url: "/pages/login/index",
        });
      }
    });
    //  #endif

    // #ifdef MP-WEIXIN
    console.log(getToken);
    if (getToken()) {
      uni.switchTab({
        url: "/pages/home/index",
      });
    } else {
      uni.navigateTo({
        url: "/pages/login/index",
      });
    }
    //  #endif
  },

  /* methods: {
    async getStatus() {
      let data = await getLoginStatus();
      this.profile = data.profile;
      console.log(data);
    },
  },
  data() {
    return {
      profile: {},
    };
  }, */
  onShow: function () {
    console.log("App Show");
  },
  onHide: function () {
    console.log("App Hide");
  },
};
</script>

<style>
/*每个页面公共css */
@import "@/static/iconfont/iconfont.css";
/*每个页面公共css */
.container {
  width: 100%;
  height: calc(100vh - 75px);
  overflow: hidden;
}
.container scroll-view {
  height: 100%;
}
.fixbg {
  width: 100%;
  height: 100vh;
  position: fixed;
  background-size: cover;
  /* background-image: url("./static/bg.png"); */
  background-position: center 0;
  filter: blur(10px);
  transform: scale(1.3);
}

uni-modal {
  z-index: 99999999999999 !important;
}
::-webkit-scrollbar {
  display: none;
  width: 0 !important;
  height: 0 !important;
  -webkit-appearance: none;
  background: transparent;
  color: transparent;
}
</style>
